package cn.edu.nwpu.manager.controller;

import cn.edu.nwpu.manager.utils.Response;
import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.PutObjectArgs;
import io.minio.errors.*;
import lombok.Cleanup;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.*;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;

/**
 * @author Hutengzhong
 * @version 1.0.0
 * @title ImgUploadController
 * @description 图片上传，不要求大家写。如果之后需要用到，使用阿里云的对象存储OSS来做。
 * @date 2023/9/15
 */
@RestController
@RequestMapping("ImgUpload")
public class ImgUploadController {

    /**
     * 图传，用minio存储
     * @param file 图片文件
     */
    @PostMapping("upload")
    public Response fileUpload(MultipartFile file) throws IOException, ServerException, InsufficientDataException, ErrorResponseException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {

        return null;
    }
}
